package com.example.demo.Mapper;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.Entity.Note;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;


@Mapper
public interface NoteMapper extends BaseMapper<Note> {


    @Select("select * from note where user_id=#{userId} ")
    List<Note> findAll(Integer userId);

    @Select("select * from note where note_tags like #{tag} ")
    List<Note> findByTag(String tag);

    @Select("select * from note where title like #{title} ")
    List<Note> findByTitle(String title);

    @Select("select name,like_num,modify_scope,user_id,note_tags,type from note , user where note.user_id=user.id and note_id=  #{noteId}")
    JSONObject findNameById(Integer noteId);

    @Select("select friend_id from friendchart where self_id = #{userId}")
    List<Integer> findFriendId(Integer userId);
}